"use strict";(globalThis.webpackChunk_github_ui_github_ui=globalThis.webpackChunk_github_ui_github_ui||[]).push([["packages_copilot-chat_hooks_use-active-plugin_ts-packages_copilot-chat_components_ChatMessage-aba353"],{7104:(e,t,n)=>{n.d(t,{$:()=>d,b:()=>u});var a=n(74848),r=n(21728),i=n(36523),s=n(34164),l=n(96540);let o={container:"ChatScrollContainer-module__container--z_iNX"},c=(0,l.createContext)(null);function d(e){let t,n,d,u,m,h,C,p,f,v=(0,r.c)(22),{children:g,disabled:x,containerRef:_,...y}=e,b=(0,i.L)(_),j=(0,l.useRef)(null),[k,w]=(0,l.useState)(!1);v[0]!==b?(t=()=>{let e=new IntersectionObserver(e=>{let[t]=e;return w(!t?.isIntersecting)},{root:b.current,threshold:0,rootMargin:"50px"});return e.observe(j.current),()=>e.disconnect()},n=[b],v[0]=b,v[1]=t,v[2]=n):(t=v[1],n=v[2]),(0,l.useEffect)(t,n);let[N,R]=(0,l.useState)();v[3]!==b?(d=()=>{let e=()=>{if(!b.current)return;let e=getComputedStyle(b.current);R(`calc(${b.current.clientHeight}px - ${e.paddingTop} - ${e.paddingBottom})`)},t=new ResizeObserver(e);return e(),t.observe(b.current),()=>t.disconnect()},u=[b],v[3]=b,v[4]=d,v[5]=u):(d=v[4],u=v[5]),(0,l.useEffect)(d,u),v[6]!==x?(m=e=>{x||j.current?.scrollIntoView({behavior:e,block:"end"})},v[6]=x,v[7]=m):m=v[7];let I=m;v[8]!==k||v[9]!==N||v[10]!==I?(h={isScrolledUp:k,scrollToBottom:I,scrollContainerHeight:N},v[8]=k,v[9]=N,v[10]=I,v[11]=h):h=v[11];let M=h,F=(0,s.$)(o.container,y.className);return v[12]===Symbol.for("react.memo_cache_sentinel")?(C=(0,a.jsx)("div",{ref:j,style:{height:"1px",marginTop:"-1px"}}),v[12]=C):C=v[12],v[13]!==g||v[14]!==b||v[15]!==y||v[16]!==F?(p=(0,a.jsxs)("div",{ref:b,...y,className:F,children:[g,C]}),v[13]=g,v[14]=b,v[15]=y,v[16]=F,v[17]=p):p=v[17],v[18]!==M||v[19]!==p||v[20]!==c.Provider?(f=(0,a.jsx)(c.Provider,{value:M,children:p}),v[18]=M,v[19]=p,v[20]=c.Provider,v[21]=f):f=v[21],f}let u=()=>{let e=(0,l.useContext)(c);if(!e)throw Error("useChatScroll may only be called in a descendant of ChatScrollContainer");return e};try{c.displayName||(c.displayName="ChatScrollContext")}catch{}try{d.displayName||(d.displayName="ChatScrollContainer")}catch{}},27359:(e,t,n)=>{n.d(t,{v:()=>l});var a=n(21728),r=n(88934),i=n(47789),s=n(38627);function l(){let e,t=(0,a.c)(3),n=(0,i.qw)(),l=(0,r.zy)();return t[0]!==l||t[1]!==n?(e=(0,s.BW)(l,n),t[0]=l,t[1]=n,t[2]=e):e=t[2],e}},46665:(e,t,n)=>{n.d(t,{$:()=>l,V:()=>o});var a=n(74848),r=n(21728),i=n(96540);let s=(0,i.createContext)(void 0),l=e=>{let t,n,i=(0,r.c)(5),{message:l,children:o}=e;i[0]!==l?(t={message:l},i[0]=l,i[1]=t):t=i[1];let c=t;return i[2]!==o||i[3]!==c?(n=(0,a.jsx)(s.Provider,{value:c,children:o}),i[2]=o,i[3]=c,i[4]=n):n=i[4],n},o=()=>{let e=(0,i.useContext)(s);if(!e)throw Error("useChatMessage must be used with ChatMessageProvider.");return e};try{s.displayName||(s.displayName="ChatMessageContext")}catch{}try{l.displayName||(l.displayName="ChatMessageProvider")}catch{}},54508:(e,t,n)=>{n.d(t,{E:()=>m});var a=n(74848),r=n(21728),i=n(73077),s=n(21373),l=n(15220),o=n(96540),c=n(2635);let d={dialog:"InterviewSurveyDialog-module__dialog--VJeZO",body:"InterviewSurveyDialog-module__body--GX6c_",primaryText:"InterviewSurveyDialog-module__primaryText--H2SlC InterviewSurveyDialog-module__text--WPIpz",secondaryText:"InterviewSurveyDialog-module__secondaryText--SQrin InterviewSurveyDialog-module__text--WPIpz",surveyLink:"InterviewSurveyDialog-module__surveyLink--XKIEl",noThanksButton:"InterviewSurveyDialog-module__noThanksButton--yLSzs"};function u(e,t){let n,u,m,h,C=(0,r.c)(11),{title:p,onClose:f}=e,v=void 0===p?"Give feedback":p,[g,x]=(0,o.useState)(!1),{currentUserLogin:_}=(0,c.bP)("currentUserLogin");C[0]===Symbol.for("react.memo_cache_sentinel")?(n=()=>({openDialog:()=>x(!0)}),C[0]=n):n=C[0],(0,o.useImperativeHandle)(t,n),C[1]!==f?(u=e=>{x(!1),f?.(e)},C[1]=f,C[2]=u):u=C[2];let y=u;C[3]!==_||C[4]!==y?(m=()=>(0,a.jsxs)("div",{className:d.body,children:[(0,a.jsx)("img",{alt:"Mona and Copilot flying a Hubot-themed spaceship",src:"/images/modules/copilot-chat/mona-copilot-hubot-spaceship.png",srcSet:"/images/modules/copilot-chat/mona-copilot-hubot-spaceship@2x.png 2x"}),(0,a.jsx)("span",{className:d.primaryText,children:"Would you like to participate in our research?"}),(0,a.jsx)("span",{className:d.secondaryText,children:"You will be compensated for your time"}),(0,a.jsx)(i.z,{variant:"primary",className:d.surveyLink,href:`https://gh.io/copilot-feedback-interview-survey?UID=${encodeURIComponent(_)}`,target:"_blank",children:"Book a session"}),(0,a.jsx)(s.Q,{variant:"link",className:d.noThanksButton,onClick:()=>y("no-thanks"),children:"No, thanks"})]}),C[3]=_,C[4]=y,C[5]=m):m=C[5];let b=m;return C[6]!==y||C[7]!==g||C[8]!==b||C[9]!==v?(h=g&&(0,a.jsx)(l.l,{className:d.dialog,onClose:()=>y("close"),title:v,renderBody:b}),C[6]=y,C[7]=g,C[8]=b,C[9]=v,C[10]=h):h=C[10],h}let m=(0,o.forwardRef)(u);try{u.displayName||(u.displayName="InterviewSurveyDialogInner")}catch{}try{m.displayName||(m.displayName="InterviewSurveyDialog")}catch{}},77274:(e,t,n)=>{n.d(t,{NE:()=>f,Mm:()=>_,YS:()=>x,mN:()=>j,XF:()=>y,Cf:()=>b,pu:()=>v,ms:()=>g});var a=n(74848),r=n(96540),i=n(86877),s=n(4175),l=n(57352),o=n(11196),c=n(21373),d=n(15220),u=n(38621);let m={bodyContainer:"UserFeedback-module__bodyContainer--G2bmg",ratingContainer:"UserFeedback-module__ratingContainer--Mg11z",ratingOption:"UserFeedback-module__ratingOption--ZLoA0",ratingButton:"UserFeedback-module__ratingButton--wgOnk",ratingCaption:"UserFeedback-module__ratingCaption--TCp_8",footerContainer:"UserFeedback-module__footerContainer--wvEjF",footerActionButtonGroup:"UserFeedback-module__footerActionButtonGroup--FzuM1",copyLogsSuccessIcon:"UserFeedback-module__copyLogsSuccessIcon--i0uqN",messageContainer:"UserFeedback-module__messageContainer--FW6dD",validationError:"UserFeedback-module__validationError--e3pDo",privacyText:"UserFeedback-module__privacyText--J0awt",Dialog:"UserFeedback-module__Dialog--n5pi6",thumbsUpIcon:"UserFeedback-module__thumbsUpIcon--dBnnS",thumbsDownIcon:"UserFeedback-module__thumbsDownIcon--Ion_2"},h={verySatisfied:"UserFeedbackColors-module__verySatisfied--HQthN",good:"UserFeedbackColors-module__good--a6lz4",satisfied:"UserFeedbackColors-module__satisfied--R1wkm",dissatisfied:"UserFeedbackColors-module__dissatisfied--fRn_n",veryDissatisfied:"UserFeedbackColors-module__veryDissatisfied--C4vDF",bad:"UserFeedbackColors-module__bad--FROJd"};var C=n(34164);function p({title:e="Give feedback",requestID:t,options:n,returnFocusRef:p,onSubmit:f,onClose:v},g){let[x,_]=(0,r.useState)(null),[y,b]=(0,r.useState)(""),[j,k]=(0,r.useState)([]),[w,N]=(0,r.useState)(0),[R,I]=(0,r.useState)(!1),[M,F]=(0,r.useState)(!1);(0,r.useEffect)(()=>{j.length>0&&N(e=>e+1)},[j]),(0,r.useImperativeHandle)(g,()=>({openDialog:e=>{if(null!=e){if(!n.some(t=>t.value===e))throw Error("invalid initial option value");_(e)}I(!0)}}));let S=e=>{_(null),b(""),k([]),I(!1),v?.(e)},L=async e=>{e.preventDefault();let t=[];try{t=await f(x,y)}catch{t=["An error occurred while submitting your feedback."]}k(t),0===t.length&&S("submit")},T=()=>S("cancel"),U=e=>{b(e.target.value),k([])},D=async()=>{if(t){try{await navigator.clipboard.writeText(`Request ID: ${t}`)}catch{k(e=>[...e,"Failed to copy logs."]);return}F(!0),setTimeout(()=>{F(!1)},1e3)}};return(0,a.jsx)(a.Fragment,{children:R&&(0,a.jsx)(d.l,{onClose:()=>S("dismiss"),title:e,renderBody:()=>(0,a.jsxs)("div",{className:m.bodyContainer,children:[(0,a.jsxs)(i.A,{required:!0,children:[(0,a.jsx)(i.A.Label,{visuallyHidden:!0,children:"Rating"}),(0,a.jsx)("div",{className:m.ratingContainer,children:n.map(e=>(0,a.jsxs)("div",{className:m.ratingOption,children:[(0,a.jsx)("button",{type:"button",role:"radio","aria-label":e.name,"aria-checked":x===e.value,onClick:()=>{_(e.value),k([])},className:(0,C.$)(m.ratingButton,h[e.color]),children:e.icon}),(0,a.jsx)("span",{className:m.ratingCaption,children:e.name})]},e.name))})]}),(0,a.jsxs)("div",{className:m.messageContainer,children:[(0,a.jsxs)(i.A,{children:[(0,a.jsx)(i.A.Label,{children:"Message"}),(0,a.jsx)(s.Ay,{placeholder:"Tell us what you liked or what could be better",value:y,onChange:U,resize:"vertical",block:!0,rows:5})]}),(0,a.jsxs)("span",{className:m.privacyText,children:["Please don\u2019t include sensitive, confidential, or personal data. Your feedback helps us improve our services in line with our"," ",(0,a.jsx)(l.A,{href:"https://docs.github.com/en/site-policy/privacy-policies/github-general-privacy-statement",inline:!0,muted:!0,children:"Privacy Policy"}),"."]}),(0,a.jsx)("div",{className:m.validationError,role:"alert",children:j.map(e=>(0,a.jsx)("div",{children:e},e))},w)]})]}),renderFooter:()=>(0,a.jsxs)("div",{className:m.footerContainer,children:[(0,a.jsx)("div",{children:t&&(0,a.jsx)(o.m,{text:"Copy logs to add in feedback",direction:"n",children:(0,a.jsx)(c.Q,{leadingVisual:M?(0,a.jsx)(u.CheckIcon,{className:m.copyLogsSuccessIcon,size:16}):(0,a.jsx)(u.CopyIcon,{size:16}),onClick:D,variant:"default",children:M?"Copied!":"Copy logs"})})}),(0,a.jsxs)("div",{className:m.footerActionButtonGroup,children:[(0,a.jsx)(c.Q,{onClick:T,children:"Cancel"}),(0,a.jsx)(c.Q,{variant:"primary",type:"submit",onClick:L,children:"Send"})]})]}),className:m.Dialog,returnFocusRef:p})})}let f=(0,r.forwardRef)(p),v=(0,a.jsx)(u.ThumbsdownIcon,{className:m.thumbsDownIcon}),g=(0,a.jsx)(u.ThumbsupIcon,{className:m.thumbsUpIcon}),x=(0,a.jsxs)("svg",{width:"16",height:"16","aria-hidden":"true",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[(0,a.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 14.5C11.5899 14.5 14.5 11.5899 14.5 8C14.5 4.41015 11.5899 1.5 8 1.5C4.41015 1.5 1.5 4.41015 1.5 8C1.5 11.5899 4.41015 14.5 8 14.5ZM8 16C12.4183 16 16 12.4183 16 8C16 3.58172 12.4183 0 8 0C3.58172 0 0 3.58172 0 8C0 12.4183 3.58172 16 8 16Z"}),(0,a.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.65646 10.7C6.15313 9.85483 7.09616 9.3 8 9.3C8.47794 9.3 9.0345 9.50535 9.54632 9.9146C9.83116 10.1424 10.0753 10.4124 10.2645 10.7H5.65646ZM11.8447 11.016C11.3379 9.39273 9.66897 8 8 8C6.30092 8 4.60185 9.23723 4.12902 11.011C3.98676 11.5446 4.44771 12 5 12H11C11.5523 12 12.0093 11.5432 11.8447 11.016Z"}),(0,a.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.89649 4.7586C4.02981 4.42529 4.40809 4.26317 4.7414 4.39649L7.00928 5.30364C7.63789 5.55509 7.6379 6.44491 7.00928 6.69636L4.7414 7.60351C4.40809 7.73683 4.02981 7.57471 3.89649 7.2414C3.76317 6.90809 3.92529 6.52981 4.2586 6.39649L5.24982 6L4.2586 5.60351C3.92529 5.47019 3.76317 5.09191 3.89649 4.7586Z"}),(0,a.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.1035 4.7586C11.9702 4.42529 11.5919 4.26317 11.2586 4.39649L8.99072 5.30364C8.36211 5.55509 8.3621 6.44491 8.99072 6.69636L11.2586 7.60351C11.5919 7.73683 11.9702 7.57471 12.1035 7.2414C12.2368 6.90809 12.0747 6.52981 11.7414 6.39649L10.7502 6L11.7414 5.60351C12.0747 5.47019 12.2368 5.09191 12.1035 4.7586Z"})]}),_=(0,a.jsxs)("svg",{width:"16",height:"16","aria-hidden":"true",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[(0,a.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 14.5C11.5899 14.5 14.5 11.5899 14.5 8C14.5 4.41015 11.5899 1.5 8 1.5C4.41015 1.5 1.5 4.41015 1.5 8C1.5 11.5899 4.41015 14.5 8 14.5ZM8 16C12.4183 16 16 12.4183 16 8C16 3.58172 12.4183 0 8 0C3.58172 0 0 3.58172 0 8C0 12.4183 3.58172 16 8 16Z"}),(0,a.jsx)("path",{d:"M6.5 6.5C6.5 7.05228 6.05228 7.5 5.5 7.5C4.94772 7.5 4.5 7.05228 4.5 6.5C4.5 5.94772 4.94772 5.5 5.5 5.5C6.05228 5.5 6.5 5.94772 6.5 6.5Z"}),(0,a.jsx)("path",{d:"M11.5 6.5C11.5 7.05228 11.0523 7.5 10.5 7.5C9.94772 7.5 9.5 7.05228 9.5 6.5C9.5 5.94772 9.94772 5.5 10.5 5.5C11.0523 5.5 11.5 5.94772 11.5 6.5Z"}),(0,a.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.3416 11.8591C9.33064 10.0058 6.66936 10.0058 5.65842 11.8591C5.46007 12.2228 5.0045 12.3568 4.64086 12.1584C4.27722 11.9601 4.14323 11.5045 4.34158 11.1409C5.92104 8.24518 10.079 8.24518 11.6584 11.1409C11.8568 11.5045 11.7228 11.9601 11.3591 12.1584C10.9955 12.3568 10.5399 12.2228 10.3416 11.8591Z"})]}),y=(0,a.jsxs)("svg",{width:"16","aria-hidden":"true",height:"16",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[(0,a.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 14.5C11.5899 14.5 14.5 11.5899 14.5 8C14.5 4.41015 11.5899 1.5 8 1.5C4.41015 1.5 1.5 4.41015 1.5 8C1.5 11.5899 4.41015 14.5 8 14.5ZM8 16C12.4183 16 16 12.4183 16 8C16 3.58172 12.4183 0 8 0C3.58172 0 0 3.58172 0 8C0 12.4183 3.58172 16 8 16Z"}),(0,a.jsx)("path",{d:"M6.5 6.5C6.5 7.05228 6.05228 7.5 5.5 7.5C4.94772 7.5 4.5 7.05228 4.5 6.5C4.5 5.94772 4.94772 5.5 5.5 5.5C6.05228 5.5 6.5 5.94772 6.5 6.5Z"}),(0,a.jsx)("path",{d:"M11.5 6.5C11.5 7.05228 11.0523 7.5 10.5 7.5C9.94772 7.5 9.5 7.05228 9.5 6.5C9.5 5.94772 9.94772 5.5 10.5 5.5C11.0523 5.5 11.5 5.94772 11.5 6.5Z"}),(0,a.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5 11C5 10.5858 5.33579 10.25 5.75 10.25H10.25C10.6642 10.25 11 10.5858 11 11C11 11.4142 10.6642 11.75 10.25 11.75H5.75C5.33579 11.75 5 11.4142 5 11Z"})]}),b=(0,a.jsxs)("svg",{width:"16","aria-hidden":"true",height:"16",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[(0,a.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 14.5C11.5899 14.5 14.5 11.5899 14.5 8C14.5 4.41015 11.5899 1.5 8 1.5C4.41015 1.5 1.5 4.41015 1.5 8C1.5 11.5899 4.41015 14.5 8 14.5ZM8 16C12.4183 16 16 12.4183 16 8C16 3.58172 12.4183 0 8 0C3.58172 0 0 3.58172 0 8C0 12.4183 3.58172 16 8 16Z"}),(0,a.jsx)("path",{d:"M6.5 6.5C6.5 7.05228 6.05228 7.5 5.5 7.5C4.94772 7.5 4.5 7.05228 4.5 6.5C4.5 5.94772 4.94772 5.5 5.5 5.5C6.05228 5.5 6.5 5.94772 6.5 6.5Z"}),(0,a.jsx)("path",{d:"M11.5 6.5C11.5 7.05228 11.0523 7.5 10.5 7.5C9.94772 7.5 9.5 7.05228 9.5 6.5C9.5 5.94772 9.94772 5.5 10.5 5.5C11.0523 5.5 11.5 5.94772 11.5 6.5Z"}),(0,a.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.3569 9.61413C9.28933 11.3934 6.71067 11.3934 5.64312 9.61413C5.43001 9.25894 4.96931 9.14377 4.61413 9.35688C4.25894 9.56999 4.14377 10.0307 4.35688 10.3859C6.00704 13.1361 9.99296 13.1361 11.6431 10.3859C11.8562 10.0307 11.7411 9.56999 11.3859 9.35688C11.0307 9.14377 10.57 9.25894 10.3569 9.61413Z"})]}),j=(0,a.jsxs)("svg",{width:"16","aria-hidden":"true",height:"16",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[(0,a.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.65646 10.3C6.15313 11.1452 7.09616 11.7 8 11.7C8.47794 11.7 9.0345 11.4947 9.54632 11.0854C9.83116 10.8576 10.0753 10.5876 10.2645 10.3H5.65646ZM11.8447 9.98403C11.3379 11.6073 9.66897 13 8 13C6.30092 13 4.60185 11.7628 4.12902 9.98904C3.98676 9.45539 4.44771 9 5 9H11C11.5523 9 12.0093 9.45684 11.8447 9.98403Z"}),(0,a.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 14.5C11.5899 14.5 14.5 11.5899 14.5 8C14.5 4.41015 11.5899 1.5 8 1.5C4.41015 1.5 1.5 4.41015 1.5 8C1.5 11.5899 4.41015 14.5 8 14.5ZM8 16C12.4183 16 16 12.4183 16 8C16 3.58172 12.4183 0 8 0C3.58172 0 0 3.58172 0 8C0 12.4183 3.58172 16 8 16Z"}),(0,a.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.3292 6.83541C10.9875 6.15213 10.0125 6.15213 9.67082 6.83541C9.48558 7.20589 9.03507 7.35606 8.66459 7.17082C8.29411 6.98558 8.14394 6.53507 8.32918 6.16459C9.22361 4.37574 11.7764 4.37574 12.6708 6.16459C12.8561 6.53507 12.7059 6.98558 12.3354 7.17082C11.9649 7.35606 11.5144 7.20589 11.3292 6.83541Z"}),(0,a.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.32918 6.83541C5.98754 6.15213 5.01246 6.15213 4.67082 6.83541C4.48558 7.20589 4.03507 7.35606 3.66459 7.17082C3.29411 6.98558 3.14394 6.53507 3.32918 6.16459C4.22361 4.37574 6.77639 4.37574 7.67082 6.16459C7.85606 6.53507 7.70589 6.98558 7.33541 7.17082C6.96493 7.35606 6.51442 7.20589 6.32918 6.83541Z"})]});try{p.displayName||(p.displayName="UserFeedbackInner")}catch{}try{f.displayName||(f.displayName="UserFeedback")}catch{}},88752:(e,t,n)=>{n.d(t,{t:()=>T,s:()=>S});var a,r=n(74848),i=n(38621),s=n(4908),l=n(23398),o=n(5524),c=n(57352),d=n(10095),u=n(34164),m=n(96540),h=n(25641),C=n(35247),p=n(2635),f=n(23967),v=n(69497),g=n(94236),x=n(33592);let _={ActionList_LinkItem:"ChatReference-module__ActionList_LinkItem--gopkk"};var y=n(35673),b=n(1631);function j({reference:e,onClick:t}){let n,a=(0,p.Pk)(),s=(0,x.b)(),l=(0,m.useRef)(null),[c,d]=(0,m.useState)(!1),C=a?.mode??"assistive",{currentReferences:f}=a??{currentReferences:[]},j=(0,m.useMemo)(()=>f.map(e=>(0,h.Vb)(e)),[f]),k=(0,m.useMemo)(()=>(0,h.Vb)(e),[e]),w=(0,m.useMemo)(()=>"repo-instructions"===e.type,[e]),N=(0,m.useMemo)(()=>"org-instructions"===e.type,[e]),R=!w&&!N&&"web-search-result"!==e.type,I=(0,m.useMemo)(()=>w||N||j.includes(k),[w,N,j,k]),M=(0,m.useCallback)(t=>{t.stopPropagation(),I||s.addReference(e,"refMenu")},[s,e,I]),F=(0,h.JP)(e),S=(0,h.Xs)(F),L=(0,b.a_)(e,(0,h.P)(a?.currentTopic));switch(e.type){case"file":case"snippet":{n=`${e.repoName}`;let t=e.path.lastIndexOf("/");-1!==t&&(n=`${n}/${e.path.substring(0,t)}`);break}case"web-search-result":n=new URL(e.url,window.location.origin).hostname.replace(/^www\./,"")}let T=(0,h.z$)(e);return(0,r.jsxs)(o.l.LinkItem,{onClick:n=>{t&&!n.defaultPrevented&&t(e,n)},href:F,rel:"noopener",className:(0,u.$)("reference-action",_.ActionList_LinkItem),target:"immersive"===C||"third-party"===e.type?"_blank":void 0,children:[L&&(0,r.jsx)(o.l.LeadingVisual,{children:(0,r.jsx)(L,{})}),(0,r.jsxs)(v.A,{title:T,maxWidth:"100%",className:"text-semibold",children:[T,n&&(0,r.jsx)("span",{className:"color-fg-muted ml-2",children:n})]}),R&&(0,r.jsx)(o.l.TrailingAction,{onClick:()=>d(!0),icon:i.KebabHorizontalIcon,label:"More reference options",ref:l}),R&&(0,r.jsx)(g.W,{anchorRef:l,open:c,onOpenChange:d,children:(0,r.jsx)(y.UJ,{portalContainerName:y.Dq,children:(0,r.jsxs)(o.l,{children:[S&&("immersive"===C||["third-party","folder","repository","docset"].includes(e.type)?(0,r.jsxs)(o.l.LinkItem,{href:F,rel:"noopener",target:"_blank",children:[(0,r.jsx)(o.l.LeadingVisual,{children:(0,r.jsx)(i.LinkIcon,{})}),"Open"]}):(0,r.jsxs)(o.l.Item,{onSelect:()=>{s.selectReference(e)},children:[(0,r.jsx)(o.l.LeadingVisual,{children:(0,r.jsx)(i.LinkIcon,{})}),"Preview"]})),(0,r.jsxs)(o.l.Item,{onSelect:M,disabled:I,children:[(0,r.jsx)(o.l.LeadingVisual,{children:(0,r.jsx)(i.PaperclipIcon,{})}),"Attach to chat"]})]})})})]})}try{j.displayName||(j.displayName="OutputReference")}catch{}try{(a=Icon).displayName||(a.displayName="Icon")}catch{}let k={referencesContainer:"ChatReferences-module__referencesContainer--qLjdy",referencesListImmersiveContainer:"ChatReferences-module__referencesListImmersiveContainer--gM5wy",title:"ChatReferences-module__title--d18y3",assistiveTitle:"ChatReferences-module__assistiveTitle--Ojcrs",referencesDetails:"ChatReferences-module__referencesDetails--Ypv2c",referenceTokensOuterContainer:"ChatReferences-module__referenceTokensOuterContainer--OV840",referenceTokensContainer:"ChatReferences-module__referenceTokensContainer--nhf9A",chatMessageReferenceListFooter:"ChatReferences-module__chatMessageReferenceListFooter--WgJAa",chevronDownIcon:"ChatReferences-module__chevronDownIcon--Fv9mJ",chevronUpIcon:"ChatReferences-module__chevronUpIcon--OPX7R",ActionList:"ChatReferences-module__ActionList--ACk2F"};var w=n(21728),N=n(69726);let R={referenceToken:"FigmaChatReference-module__referenceToken--PONuv",name:"FigmaChatReference-module__name--XjBR8",content:"FigmaChatReference-module__content--Mpcb0",thumbnail:"FigmaChatReference-module__thumbnail--mm7QC",thumbnailHidden:"FigmaChatReference-module__thumbnailHidden--pv7wD",thumbnailOuter:"FigmaChatReference-module__thumbnailOuter--oMFvD",thumbnailLoading:"FigmaChatReference-module__thumbnailLoading--cQ2Uf",figmaIconOuter:"FigmaChatReference-module__figmaIconOuter--KtveL",figmaIcon:"FigmaChatReference-module__figmaIcon--kEY45"};var I=n(89237);let M=(0,m.forwardRef)(function(e,t){let n,a,i,s,l,o,c,d,C,p,f=(0,w.c)(23);f[0]!==e?({reference:n,...a}=e,f[0]=e,f[1]=n,f[2]=a):(n=f[1],a=f[2]);let[v,g]=(0,m.useState)(!0);return f[3]!==n?(i=(0,h.JP)(n),f[3]=n,f[4]=i):i=f[4],f[5]===Symbol.for("react.memo_cache_sentinel")?(s=(0,u.$)(R.referenceToken),f[5]=s):s=f[5],f[6]!==n.thumbnailUrl||f[7]!==n.title||f[8]!==v?(l=n.thumbnailUrl&&(0,r.jsxs)(r.Fragment,{children:[v&&(0,r.jsx)("span",{className:R.thumbnailLoading,children:(0,r.jsx)(N.A,{size:"medium"})}),(0,r.jsx)("img",{className:(0,u.$)(R.thumbnail,{[R.thumbnailHidden]:v}),src:n.thumbnailUrl,alt:`preview thumbnail for ${n.title}`,onLoad:()=>g(!1)})]}),f[6]=n.thumbnailUrl,f[7]=n.title,f[8]=v,f[9]=l):l=f[9],f[10]!==l?(o=(0,r.jsx)("span",{className:R.thumbnailOuter,children:l}),f[10]=l,f[11]=o):o=f[11],f[12]===Symbol.for("react.memo_cache_sentinel")?(c=(0,r.jsx)("div",{className:R.figmaIconOuter,children:(0,r.jsx)(I._,{className:R.figmaIcon})}),f[12]=c):c=f[12],f[13]!==n?(d=(0,h.z$)(n),f[13]=n,f[14]=d):d=f[14],f[15]!==d?(C=(0,r.jsxs)("span",{className:R.content,children:[c,(0,r.jsx)("span",{className:R.name,children:d})]}),f[15]=d,f[16]=C):C=f[16],f[17]!==t||f[18]!==a||f[19]!==i||f[20]!==o||f[21]!==C?(p=(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("a",{href:i,className:s,ref:t,target:"_blank",rel:"noreferrer",...a,children:[o,C]})}),f[17]=t,f[18]=a,f[19]=i,f[20]=o,f[21]=C,f[22]=p):p=f[22],p});try{M.displayName||(M.displayName="FigmaChatReference")}catch{}var F=n(95896);function S({references:e,onToggle:t,onClick:n,isImmersive:a,className:C}){let f=(0,p.Pk)(),v=(0,m.useMemo)(()=>(0,h.rT)(e),[e]),{getDetailsProps:g}=(0,s.A)({}),x=(0,m.useMemo)(()=>(0,h.P)(f?.currentTopic)&&v.every(L),[f?.currentTopic,v]),_=(0,m.useMemo)(()=>v.some(e=>"web-search-result"===e.type),[v]);if(0===v.length)return null;let y=x&&f?.currentTopic?.name?`Search results from ${f.currentTopic.name}`:`${v.length} ${1===v.length?"reference":"references"}`;return(0,r.jsxs)(l.A,{...g(),onToggle:t,className:(0,u.$)(C,k.referencesDetails),children:[(0,r.jsxs)("summary",{className:(0,u.$)(k.referencesContainer),children:[(0,r.jsx)("span",{className:(0,u.$)(k.title,a?"":k.assistiveTitle),children:y}),(0,r.jsx)(d.A,{icon:i.ChevronDownIcon,className:(0,u.$)("references-chevron-down",k.chevronDownIcon)}),(0,r.jsx)(d.A,{icon:i.ChevronUpIcon,className:(0,u.$)("references-chevron-up",k.chevronUpIcon)})]}),(0,r.jsxs)(o.l,{className:(0,u.$)(a&&k.referencesListImmersiveContainer,k.ActionList),children:[v.map(e=>(0,r.jsx)(j,{reference:e,onClick:n},(0,h.Vb)(e))),_&&(0,r.jsxs)("div",{className:k.chatMessageReferenceListFooter,children:["Copilot used the"," ",(0,r.jsx)(c.A,{inline:!0,href:"https://gh.io/azure-ai-agent-with-bing-grounding",target:"_blank",rel:"noopener noreferrer",children:"Bing Search"})," ","tool."," ",(0,r.jsx)(c.A,{inline:!0,href:"https://privacy.microsoft.com/privacystatement",rel:"nofollow",target:"_blank",children:"Microsoft Privacy Statement"})]})]})]})}function L(e){return"snippet"===e.type&&!!e.languageName&&f.Yr.has(e.languageName)}function T({references:e,message:t,className:n,size:a,onClickReference:i,getReferenceVersion:s}){let{bigReferences:l,smallReferences:o}=(0,m.useMemo)(()=>(function(e){let t=(0,h.rT)(e),n=[],a=[];for(let e of t)U.has(e.type)?n.push(e):a.push(e);return{bigReferences:n,smallReferences:a}})(e),[e]),c=e=>"figma"===e.type&&C.W.immersiveFigmaIntegration?(0,r.jsx)(M,{reference:e,onClick:t=>i?.(e,t)},(0,h.Vb)(e)):(0,r.jsx)(b.BR,{message:t,reference:e,size:a,onClick:(t,n)=>i?.(e,n),getReferenceVersion:s},(0,h.Vb)(e));return(0,r.jsxs)(F.M,{"aria-label":"Attachments",className:(0,u.$)(k.referenceTokensOuterContainer,n),children:[l.map(c),(0,r.jsx)("div",{className:k.referenceTokensContainer,children:o.map(c)})]})}let U=new Set(["figma","image"]);try{S.displayName||(S.displayName="ChatMessageReferencesList")}catch{}try{T.displayName||(T.displayName="ChatMessageReferenceTokens")}catch{}try{U.displayName||(U.displayName="BIG_REFERENCE_TYPES")}catch{}},95896:(e,t,n)=>{n.d(t,{M:()=>o});var a=n(74848),r=n(21728),i=n(11683),s=n(45800),l=n(96540);function o(e){let t,n,o,c,d=(0,r.c)(8);d[0]!==e?({className:t,...n}=e,d[0]=e,d[1]=t,d[2]=n):(t=d[1],n=d[2]);let u=(0,l.useRef)(null);return d[3]===Symbol.for("react.memo_cache_sentinel")?(o={containerRef:u,focusInStrategy:"first",focusOutBehavior:"stop",bindKeys:i.z0.ArrowHorizontal|i.z0.HomeAndEnd},d[3]=o):o=d[3],(0,s.G)(o),d[4]!==t||d[5]!==e.children||d[6]!==n?(c=(0,a.jsx)("div",{ref:u,className:t,role:"toolbar",...n,children:e.children}),d[4]=t,d[5]=e.children,d[6]=n,d[7]=c):c=d[7],c}try{o.displayName||(o.displayName="Toolbar")}catch{}}}]); //# sourceMappingURL=packages_copilot-chat_hooks_use-active-plugin_ts-packages_copilot-chat_components_ChatMessage-aba353-cdd496c5a55a.js.map